using System.Drawing;
using System.Windows.Forms;

namespace WIT.DAQ.Core.Extension;

/// <summary>
/// WindowsForm扩展类
/// </summary>
internal static class WinformExtension
{
	/// <summary>
	/// 将Form设置居中（不包括任务栏、停靠窗口和停靠工具栏）
	/// </summary>
	/// <param name="form"></param>
	internal static void SetCenter(this Form form)
	{
		Rectangle workingArea = Screen.GetWorkingArea(form);
		form.Location = new Point((workingArea.Width - form.Width) / 2, (workingArea.Height - form.Height) / 2);
	}
}
